Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panel scrollbar update #726

Closed
wants to merge 6 commits into from

Conversation

KenediaDev
Copy link

No description provided.

- Reflow functions now use the *ContentRegion* Width instead of the Width of the Panel
- Default Scrollbar Padding is 4 px
- to handle panels inside panels which use FILL to be sized correctly some scrollbar properties have been moved up from (Flow)Panel to Container
- Content Regions only resize to their VISIBILE childs size instead of accounting for any which resulted in panels to not grow back to smaller sizes when hiding bigger controls
- Scrollbar now returns the _barBounds.Width instead of the _textureBar.Width
@@ -146,6 +196,7 @@ public abstract class Container : Control, IEnumerable<Control> {

public bool AddChild(Control child) {
if (_children.Contains(child)) return true;
if (_panelScrollbar != null && child == _panelScrollbar) return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be shortened to

return _panelScrollbar != null && child == _panelScrollbar

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that return always and not continue to add the child?

@dlamkins
Copy link
Member

dlamkins commented Sep 6, 2022

Can you please include a description of all of the changes or provide a link to a full summary of where you've described it in Discord?

@dlamkins
Copy link
Member

dlamkins commented Sep 6, 2022

image

I'm seeing weird issues with many of the containers. This is a bit confusing with how it appears to be modifying the content region.

@KenediaDev
Copy link
Author

Container.cs

Properties:

  • added a _panelScrollbar property which is either null or the scrollbar of the container
  • added a new public property ScrollPadding which determines the Padding on the left side of the Scrollbar
  • added a new public bool property ScrollbarVisible which tells if the scrollbar is visible or not
  • added a new public int property ScrollbarWidth which returns the current scrollbar width (0 if null)
  • added a new public Point property MaxSize which lets you limit the size a container would get resized to
  • added a new public int property MaxWidth which lets you limit the width a container would get resized to -> MaxSize.x
  • added a new public int property MaxHeight which lets you limit the width a container would get resized to -> MaxSize.y

Methods:

  • exclude the scrollbar from the Child handling of the container
  • take MaxSize into account when resizing the container
  • disposing the scrollbar on dispose

Scrollbar.cs

Properties:

  • added a new public bool property Drawn which tells if the scrollbar is visible and drawn or not
  • added a new public int property ScrollbarWidth which returns the scrollbar width

Panel.cs

Methods:
RecalculateLayout

  • updating the ScrollbarVisible property
  • updating the _panelScrollbar if not null to match the container size

UpdateScrollbar

  • adjusted _panelScrollbar.Right to get the position right

FlowPanel.cs

Methods:
all variants of ReflowChildLayout

  • using the ContentRegion instead of the container bounds for layout calculations to avoid the scrollbar bounds

@KenediaDev
Copy link
Author

moved to #749 for a cleaner PR

@KenediaDev KenediaDev closed this Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants